<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!-- 引入bootstrap -->
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
<!-- 引入JQuery  bootstrap.js-->
<script src="<%=request.getContextPath()%>/js/bootstrap.min.js"></script>
<%--<script src="<%=request.getContextPath()%>/js/jquery.validate.min.js"></script>--%>
<script src="<%=request.getContextPath()%>/js/jquery-3.2.1.min.js"></script>
<html>
<head>
    <title>选择题页面</title>
    <script type="text/javascript">
        console.log(${requestScope.question.answer});
        function radioSubmit(){
            var radio=$("input[name='answer']:checked").val();
            console.log(radio);
            if(radio=='${question.answer}'){
                console.log("答案正确");
                window.location.href ="<%=request.getContextPath()%>/exam/Type_choose?question_type=${question.question_type}";
            }
            else{
                alert("答案错误，挑战结束！！");
                window.location.href ="<%=request.getContextPath()%>/exam/challenge";
            }

        }



    </script>
</head>
<body>

<div class="form-group">
    游戏模式介绍:</br>
    “百发百中”是做一题提交一题，若正确，就出现下一题，若错误，则挑战失败。</br>
     <input name="id" value="${requestScope.question.id}" hidden="hidden"/>
    <label class="control-label">${requestScope.question.title}</label>
    <br>
    <label class="radio-inline">
        <input type="radio" name="answer" value="A" checked="checked">A.${question.attrA}
    </label>
    <label class="radio-inline">
        <input type="radio" name="answer" value="B">B.${question.attrB}
    </label>
    <label class="radio-inline">
        <input type="radio" name="answer" value="C" >C.${question.attrC}
    </label>
    <label class="radio-inline">
        <input type="radio" name="answer" value="D" >D.${question.attrD}
    </label>
</div>
    <button type="button" onclick="radioSubmit()">提交</button>

</body>

</html>
